package pbbltobpel.model;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Variable implements IXmlWriter {
	private String name;
	private String messageType;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getMessageType() {
		return messageType;
	}
	public void setMessageType(String messageType) {
		this.messageType = messageType;
	}
	
	public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj == null || obj.getClass() != this.getClass()) {
            return false;
        }

       // System.out.println("test");
        
        Variable variable = (Variable) obj;
        return variable.name.equals(name)
        		&& variable.messageType.equals(messageType);
	}
	
	@Override
	public Element getXmlElement(Document doc) {
		Element element = doc.createElement("bpel:variable");
		element.setAttribute("name", name);
		element.setAttribute("messageType", messageType);
		return element;
	}
}
